const Animation = {
    fade: {
        show: function (element) {
            console.log(element, 'fade show');
        },
        hide: function (element) {
            console.log(element, 'fade hide');
        }
    },
    slide: {
        show: function (element) {
            console.log(element, 'slide show');
        },
        hide: function (element) {
            console.log(element, 'slide hide');
        }
    }
}

function Toast(element, animation) {
    this.element = element;
    this.animation = animation;
}

Toast.prototype.show = function () {
    this.animation.show(this.element);
}
Toast.prototype.hide = function () {
    this.animation.hide(this.element);
}

const toast = new Toast('div', Animation.fade);
toast.show();
setTimeout(() => {
    toast.hide();
}, 1000)

